home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / bluez.preinst < prev    next >
Text File  |  2009-09-24  |  2KB  |  53 lines

  1. #!/bin/sh -e
  2.  
  3. # snippet from http://www.dpkg.org/dpkg/ConffileHandling
  4.  
  5. # Prepare to move a conffile without triggering a dpkg question
  6. prep_mv_conffile() {
  7.     CONFFILE="$1"
  8.  
  9.     if [ -e "$CONFFILE" ]; then
  10.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  11.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  12.         if [ "$md5sum" = "$old_md5sum" ]; then
  13.             rm -f "$CONFFILE"
  14.         fi
  15.     fi
  16. }
  17.  
  18. # Remove a no-longer used conffile
  19. rm_conffile() {
  20.     PKGNAME="$1"
  21.     CONFFILE="$2"
  22.     if [ -e "$CONFFILE" ]; then
  23.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  24.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  25.         if [ "$md5sum" != "$old_md5sum" ]; then
  26.             echo "Obsolete conffile $CONFFILE has been modified by you."
  27.             echo "Saving as $CONFFILE.dpkg-bak ..."
  28.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  29.         else
  30.             echo "Removing obsolete conffile $CONFFILE ..."
  31.             rm -f "$CONFFILE"
  32.         fi
  33.     fi
  34. }
  35.  
  36. case "$1" in
  37. install|upgrade)
  38.     if dpkg --compare-versions "$2" le "3.7-1"; then
  39.         prep_mv_conffile "/etc/dbus-1/system.d/bluez-hcid.conf"
  40.     fi
  41.  
  42.     if dpkg --compare-versions "$2" le "3.30-1"; then
  43.         rm_conffile bluez-utils "/etc/bluetooth/network.service"
  44.         rm_conffile bluez-utils "/etc/bluetooth/serial.service"
  45.         rm_conffile bluez-utils "/etc/bluetooth/input.service"
  46.     fi
  47.     if dpkg --compare-versions "$2" le "4.45-1"; then
  48.         rm_conffile bluez "/etc/default/bluetooth"
  49.     fi
  50. esac
  51.  
  52.  
  53.